package py.una.pol.ii.is2.domain.registro;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import py.una.pol.ii.is2.domain.flota.Vehiculo;

/**
 *  @author mbenitez
 *  @date 30/04/2009
 */
@Entity
@Table(name = "registro_utilizacion")
@NamedQueries({@NamedQuery(name = "RegistroUtilizacion.findAll", query = "SELECT r FROM RegistroUtilizacion r"), @NamedQuery(name = "RegistroUtilizacion.findByReutCod", query = "SELECT r FROM RegistroUtilizacion r WHERE r.reutCod = :reutCod"), @NamedQuery(name = "RegistroUtilizacion.findByReutFecha", query = "SELECT r FROM RegistroUtilizacion r WHERE r.reutFecha = :reutFecha"), @NamedQuery(name = "RegistroUtilizacion.findByReutDescripcion", query = "SELECT r FROM RegistroUtilizacion r WHERE r.reutDescripcion = :reutDescripcion"), @NamedQuery(name = "RegistroUtilizacion.findByReutInOut", query = "SELECT r FROM RegistroUtilizacion r WHERE r.reutInOut = :reutInOut")})
public class RegistroUtilizacion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="reguti_generator")
    @SequenceGenerator(name="reguti_generator", sequenceName="registro_utilizacion_reut_cod_seq", allocationSize=1)
    @Basic(optional = false)
    @Column(name = "reut_cod")
    private Integer reutCod;
    @Column(name = "reut_fecha")
    @Temporal(TemporalType.TIMESTAMP)
    private Date reutFecha;
    @Column(name = "reut_descripcion")
    private String reutDescripcion;
    @Column(name = "reut_in_out")
    private Character reutInOut;
    @JoinColumn(name = "reut_cod_chofer", referencedColumnName = "chof_cod")
    @ManyToOne(optional = false)
    private Chofer reutCodChofer;
    @JoinColumn(name = "reut_cod_vehiculo", referencedColumnName = "vehi_cod")
    @ManyToOne(optional = false)
    private Vehiculo reutCodVehiculo;

    public RegistroUtilizacion() {
    }

    public RegistroUtilizacion(Integer reutCod) {
        this.reutCod = reutCod;
    }

    public Integer getReutCod() {
        return reutCod;
    }

    public void setReutCod(Integer reutCod) {
        this.reutCod = reutCod;
    }

    public Date getReutFecha() {
        return reutFecha;
    }

    public void setReutFecha(Date reutFecha) {
        this.reutFecha = reutFecha;
    }

    public String getReutDescripcion() {
        return reutDescripcion;
    }

    public void setReutDescripcion(String reutDescripcion) {
        this.reutDescripcion = reutDescripcion;
    }

    public Character getReutInOut() {
        return reutInOut;
    }

    public void setReutInOut(Character reutInOut) {
        this.reutInOut = reutInOut;
    }

    public Chofer getReutCodChofer() {
        return reutCodChofer;
    }

    public void setReutCodChofer(Chofer reutCodChofer) {
        this.reutCodChofer = reutCodChofer;
    }

    public Vehiculo getReutCodVehiculo() {
        return reutCodVehiculo;
    }

    public void setReutCodVehiculo(Vehiculo reutCodVehiculo) {
        this.reutCodVehiculo = reutCodVehiculo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (reutCod != null ? reutCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RegistroUtilizacion)) {
            return false;
        }
        RegistroUtilizacion other = (RegistroUtilizacion) object;
        if ((this.reutCod == null && other.reutCod != null) || (this.reutCod != null && !this.reutCod.equals(other.reutCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.una.pol.ii.is2.dao.flota.RegistroUtilizacion[reutCod=" + reutCod + "]";
    }

}
